package com.yh.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class SaldUtil {

	public static String getPassWordSald(String password,String userName){
		    int hashIterations = 10000;//加密的次数  
	        ByteSource salt = ByteSource.Util.bytes(userName);//盐值  
	        Object credentials = password;//密码  
	        String hashAlgorithmName = "MD5";//加密方式  
	        SimpleHash hash = new SimpleHash(hashAlgorithmName, credentials,salt,hashIterations);
	        System.out.println("加密后的值----->" + hash);  
	        
		return hash.toString();
	}
}
